package io.gitee.thinkbungee.entity.mongo;

import io.gitee.thinkbungee.entity.TableEntity;
import lombok.Data;

import java.util.List;
import java.util.Map;

/**
 * mysql一张表代表一个实体
 * mongo可能一张表可能有多个实体
 *
 * @author chenyichang
 * @date 2022/5/24
 */
@Data
public class MongoGeneratorEntity {
    /**
     * 表信息
     */
    private Map<String, String> tableInfo;

    /**
     * 主类的列名信息
     */
    private List<Map<String, String>> columns;


    /**
     * 组装table信息
     */
    public TableEntity toTableEntity() {
        TableEntity tableEntity = new TableEntity();
        Map<String, String> tableInfo = this.tableInfo;
        tableEntity.setTableName(tableInfo.get("tableName"));
        tableEntity.setComment("");
        return tableEntity;
    }

}
